#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDockWidget>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QDockWidget* dockwidget = new QDockWidget();
    dockwidget->setWindowTitle("这是一个子窗口");
    this->addDockWidget(Qt::LeftDockWidgetArea, dockwidget);
    QWidget* widget = new QWidget();
    dockwidget->setWidget(widget);
    QVBoxLayout* layout = new QVBoxLayout();
    widget->setLayout(layout);
    QPushButton* button = new QPushButton("按钮");
    layout->addWidget(button);
    QLabel* label = new QLabel("这是一段文本");
    layout->addWidget(label);
}

MainWindow::~MainWindow()
{
    delete ui;
}

